﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.SharePoint;
using System.Net.Mail;
using Microsoft.SharePoint.Administration;
using System.IO;

namespace HPT
{
    public static class Constants
    {
        public static class List
        {
            public const string News = "News";

            
            public static string RecycleBin(string listName) { return String.Format("RecycleBin{0}", listName); }
        }

        public static class Messages
        {
            public const string NotHavePermissionAccessPage = "You might not have permission to acess this page.";
            public const string NotHavePermissioDeleteItems = "You might not have permission to delete item(s).";
        }

        public static class Filter
        {
            public const string SelectAll = "(Select All)";
            public const string Blanks = "(Blanks)";
        }
        public const string NA = "#NA";

        public static class Format
        {
            public const string FranceDateFormat = "d-MMM-yyyy";
            public const string DateFormat = "dd-MMM-yyyy";
            public const string MonthFormat = "MMMM yyyy";
            public const string IntFormat = "N0";
            public const string IntZFormat = "##,#;-##,#;-"; //Int with Zero value is '-'
            public const string DecimalFormat = "N2";
            public const string DecimalZFormat = "##,##0.00;-##,##0.00;-"; //Decimal with Zero value is '-'
            public const string PercentFormat = "P";
            public const string PercentZFormat = "0.00%;-0.00%;-";
            public const string ReportMonthFormat = "MMMyy’";
            public const string DashboardMonthFormat = "MMM ’yy";
            public const string ChatTimeFormat = "h:mm tt";
        }

        public static class Paths
        {
            public const string DatabaseExtension = "ods";
            private const string ROOT_PATH = @"C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\LAYOUTS\OnlineDatabase\";
            private const string TEMP_PATH = @"C:\Windows\Temp\OnlineDatabase\";
            private static string applicatrionTempFolder, datas, reports, timerJobs, templates, tempPath, viewState, exportPath, emailAttachsPath, reportDefinitionFiles;
            public static string Templates
            {
                get
                {
                    if (String.IsNullOrEmpty(templates))
                    {
                        templates = Path.Combine(ROOT_PATH, "Templates");
                        if (!Directory.Exists(templates))
                            System.IO.Directory.CreateDirectory(templates);
                    }
                    return templates; 
                }
            }

            public static string Datas
            {
                get
                {
                    if (String.IsNullOrEmpty(datas))
                    {
                        datas = Path.Combine(ROOT_PATH, "Datas");
                        if (!Directory.Exists(datas))
                            System.IO.Directory.CreateDirectory(datas);
                    }
                    return datas;
                }
            }

            public static string ApplicatrionTempFolder
            {
                get
                {
                    if (String.IsNullOrEmpty(applicatrionTempFolder))
                    {
                        if (!Directory.Exists(TEMP_PATH))
                            System.IO.Directory.CreateDirectory(TEMP_PATH);
                        applicatrionTempFolder = TEMP_PATH;
                    }
                    return applicatrionTempFolder;
                }
            }
            public static string TempPath
            {
                get
                {
                    if (String.IsNullOrEmpty(tempPath))
                    {
                        tempPath = Path.Combine(ApplicatrionTempFolder, "Temps");
                        if (!Directory.Exists(tempPath))
                            System.IO.Directory.CreateDirectory(tempPath);
                    }
                    return tempPath;
                }
            }
            public static string ViewState
            {
                get
                {
                    if (String.IsNullOrEmpty(viewState))
                    {
                        viewState = Path.Combine(ApplicatrionTempFolder, "ViewState");
                        if (!Directory.Exists(viewState))
                            System.IO.Directory.CreateDirectory(viewState);
                    }
                    return viewState;
                }
            }
            public static string ExportPath
            {
                get
                {
                    if (String.IsNullOrEmpty(exportPath))
                    {
                        exportPath = Path.Combine(ApplicatrionTempFolder, "Exports");
                        if (!Directory.Exists(exportPath))
                            System.IO.Directory.CreateDirectory(exportPath);
                    }
                    return exportPath;
                }
            }
            public static string EmailAttachsPath
            {
                get
                {
                    if (String.IsNullOrEmpty(emailAttachsPath))
                    {
                        emailAttachsPath = Path.Combine(ApplicatrionTempFolder, "EmailAttachs");
                        if (!Directory.Exists(emailAttachsPath))
                            System.IO.Directory.CreateDirectory(emailAttachsPath);
                    }
                    return emailAttachsPath;
                }
            }
        }
    }
}
